﻿using System;

class BallBouncing
{
    static void Main(string[] args)
    {
        Console.WriteLine("球落地运动计算程序");
        Console.WriteLine("=================");

        double initialHeight = 100.0; 
        int landings = 10;            

        var result = CalculateBouncing(initialHeight, landings);

        DisplayResults(initialHeight, landings, result);
    }

   
    static (double totalDistance, double tenthBounceHeight) CalculateBouncing(double initialHeight, int landings)
    {
        double totalDistance = 0;
        double currentHeight = initialHeight;

        for (int i = 1; i <= landings; i++)
        {
            if (i == 1)
            {
               
                totalDistance += currentHeight;
            }
            else
            {
               
                totalDistance += currentHeight * 2;
            }

           
            currentHeight /= 2;

            Console.WriteLine($"第{i}次落地：总路程 = {totalDistance:F2}米, 下次反弹高度 = {currentHeight:F2}米");
        }

        return (totalDistance, currentHeight);
    }

    
    static void DisplayResults(double initialHeight, int landings, (double totalDistance, double tenthBounceHeight) result)
    {
        Console.WriteLine("\n 最终结果：");
        Console.WriteLine("================");
        Console.WriteLine($"初始高度：{initialHeight}米");
        Console.WriteLine($"第{landings}次落地时：");
        Console.WriteLine($"• 总共经过的路程：{result.totalDistance:F2}米");
        Console.WriteLine($"• 第{landings}次反弹高度：{result.tenthBounceHeight:F4}米");

        Console.WriteLine($"\n 分析：");
        Console.WriteLine($"第10次反弹高度是初始高度的 {result.tenthBounceHeight / initialHeight * 100:F6}%");
        Console.WriteLine($"相当于 {result.tenthBounceHeight * 100:F2} 厘米");
    }
}